<?php
class User_msg_relationship extends AppModel
{
    var $name = 'User_msg_relationship';
    var $primaryKey = 'id'; 
  

    var $belongsTo = array(
        'Msg' => array(
            'conditions' => array("Msg.is_deleted='0' "),
           // 'fields' => "Msg.subject,Msg.content",
            'className'    => 'Msg',
            'foreignKey'    => 'id_two'
        ));
        
 	
    //企业信息中截止日期到期提醒功能
    function addalertrelationship($mydata = array()){
    	if (!empty($mydata)){
      		$this->data['User_msg_relationship']['id_one'] = $mydata['id_one'];
    		$this->data['User_msg_relationship']['relationship'] = $mydata['relationship'];
    		$this->data['User_msg_relationship']['id_two'] = $mydata['id_two'];
    		$this->data['User_msg_relationship']['is_readed'] = $mydata['is_readed'];
    	
    		if ($this->save($this->data['User_msg_relationship'])){
    			return $this->getLastInsertId();
    		}else{
    			return false;
    		}
    	}else{
    		return false;
    	}
    }
}
?>